package cn.naughtior.shch.utils;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.connection.Connection;
import org.springframework.amqp.rabbit.connection.ConnectionListener;

import java.io.IOException;

/**
 * ${DESCRIPTION}
 *
 * @author shitou<shitou@in66.com>
 * @create 2017-01-16 17:34
 */

public class JiuyanConnectionListener implements ConnectionListener {
    @Override
    public void onCreate(Connection connection) {
        Channel channel = connection.createChannel(false);
        channel.getConnection().addBlockedListener(new JiuyanRabbitMqBlockedListener());
        try {
            channel.close();
        }
        catch (IOException e) {
        }
    }

    @Override
    public void onClose(Connection connection) {

    }
}
